﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLBS.Entity;

namespace NLBS.Data.Interface
{
    public interface IArticleService
    {
        #region Article

         IList<Article> GetArticle();

        /// <summary>
        /// 获取日志前后日志
        /// </summary>
        /// <param name="articleID">日志ID</param>
        /// <returns></returns>
         IList<ArticleLink> GetPreviousAndNextArticle(int articleID);

        /// <summary>
        /// 获取最新日志
        /// </summary>
        /// <param name="topCount"></param>
        /// <returns></returns>
         IList<Article> GetTopArticle(int topCount);

        /// <summary>
        /// 根据用户ID获取日志
        /// </summary>
        /// <param name="startIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="userID"></param>
        /// <returns></returns>
         IPagedCollection<Article> GetArticleByUserID(int startIndex, int pageSize, int userID);

        /// <summary>
        /// 分页获取日志
        /// </summary>
        /// <param name="startIndex">起始页</param>
        /// <param name="pageSize">每页显示日志数</param>
        /// <returns></returns>
         IPagedCollection<Article> GetAllArticleByPage(int startIndex, int pageSize);

         IPagedCollection<Article> GetRssArticleByPage(int pageSize);

        /// <summary>
        /// 根据分类分页获取日志
        /// </summary>
        /// <param name="startIndex">起始页</param>
        /// <param name="pageSize">每页显示日志数</param>
        /// <param name="catID">分类ID</param>
        /// <returns></returns>
         IPagedCollection<Article> GetCatArticleByPage(int startIndex, int pageSize, int catID);

        /// <summary>
        /// 获取精选日志
        /// </summary>
        /// <param name="startIndex">起始页</param>
        /// <param name="pageSize">每页显示日志数</param>
        /// <returns></returns>
         IPagedCollection<Article> GetSelectedArticleByPage(int startIndex, int pageSize);
        /// <summary>
        /// 根据日志的ID获取一篇日志
        /// </summary>
        /// <param name="articleID">日志ID</param>
        /// <returns></returns>
         Article GetArticleByID(int articleID);

        /// <summary>
        /// 新增一条日志
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
         int InsertArticle(Article item);

        /// <summary>
        /// 更新一条日志
        /// </summary>
        /// <param name="item"></param>
         void UpdateArticle(Article item);

         void UpdateArticleViewCount(int articleId);

        /// <summary>
        /// 根据日志的ID删除日日志
        /// </summary>
        /// <param name="articleID"></param>
         void DeleteArticle(int articleID);

         int GetArticleCategoryCount(int catID);

        /// <summary>
        /// 根据月份获取日志
        /// </summary>
        /// <param name="startIndex">起始页</param>
        /// <param name="pageSize">每页显示日志数</param>
        /// <param name="year">年</param>
        /// <param name="month">月</param>
        /// <returns></returns>
         IPagedCollection<Article> GetPagedArticleByMonth(int startIndex, int pageSize, int year, int month);

        /// <summary>
        /// 根据年份获取日志
        /// </summary>
        /// <param name="startIndex">起始页</param>
        /// <param name="pageSize">每页显示日志数</param>
        /// <param name="year">年</param>
        /// <returns></returns>
         IPagedCollection<Article> GetPagedArticleByYear(int startIndex, int pageSize, int year);

        /// <summary>
        /// 根据具体某天获取日志
        /// </summary>
        /// <param name="startIndex">起始页</param>
        /// <param name="pageSize">每页显示日志数</param>
        /// <param name="date">当前时间</param>
        /// <returns></returns>
         IPagedCollection<Article> GetPagedArticleByDay(int startIndex, int pageSize, DateTime date);

        /// <summary>
        /// 获取日志归档
        /// </summary>
        /// <returns></returns>
         IList<Archive> GetArticleMonthArchive();

         IList<Article> GetAllArticleByMonth(int year, int month);

        /// <summary>
        /// 根据关键字搜索日志
        /// </summary>
        /// <param name="startIndex">起始页</param>
        /// <param name="pageSize">每页显示日志数</param>
        /// <param name="prefix">关键字</param>
        /// <returns></returns>
         IPagedCollection<Article> GetPagedArticleBySearch(int startIndex, int pageSize, string prefix);

        /// <summary>
        /// 在更新时更新日志总数
        /// </summary>
        /// <param name="oldCatID">日志原分类ID</param>
        /// <param name="catID">现在日志ID</param>
        /// <param name="authorID">作者ID</param>
         void UpdateArticleCount(int oldCatID, int catID, int authorID);


        #endregion
    }
}
